<%@ page language="java" 

import="java.util.*" 
import="edu.cnu.tpts.dao.TeacherDao" 
import="edu.cnu.tpts.dao.impl.TeacherDaoImpl" 
import="edu.cnu.tpts.bean.Teacher" 
import="edu.cnu.tpts.bean.Course" 

pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/authorize.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'showTeacher.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->


  </head>
  
  <body>
 

<div class="table">
    	<%
    	TeacherDaoImpl teacherDao=new TeacherDaoImpl(); 
    	List<Teacher> teacherList=teacherDao.getAll();
    	
    	 %>
    	<table border="1px solid;">
    	<tr><td>教师编号</td><td>教师名称</td><td>性别</td><td>所在院系</td><td>教授课程</td></tr>
    	 <%for(Teacher teacher:teacherList){ 
    	
    	%>
    	<tr>
    	<td><%=teacher.getId() %></td>
    	<td><%=teacher.getRealName() %></td>
    	
    	<td><%=teacher.getSex() %></td>
    	<td><%=teacher.getTeaDepartment() %></td>
    	<td>
    	<%List<Course> courseList=teacherDao.getTeacheCourse(teacher); 
    	for(Course  course:courseList){
    	%>
    	<%=course.getName() %>,
    	<%} %>
    	</td>
    	</tr>
    	 	<%} %>
    	</table>
    	</div>
  </body>
</html>
